<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="format-detection" content="telephone=yes" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
    <script src="js/jquery-3.5.1.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/bootStrap.css">
    <link rel="stylesheet" href="css/mpicker.css?id=1">
    <title>招商加盟</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .head {
            position: fixed;
            top: 0;
            animation: scratchy 1s linear infinite;
        }

        .top {
            background: #FC1114;
            width: 100%;
            height: 88px;
            position: fixed;
            top: 0;
            z-index: 999;
        }

        @keyframes scratchy {
            from {
                background: url('image/head.png') no-repeat center;
                opacity: .1
            }

            50% {
                background: url('image/head.png') no-repeat center;
                opacity: 1
            }

            to {
                background: url('image/head.png') no-repeat center;
                opacity: .1
            }

        }

        img {
            width: 100%;
        }

        .bottom {
            width: 100%;
            z-index: 1;
            position: fixed;
            bottom: 0;
            display: flex;
            align-items: center;
        }

        .share_money {
            width: 50%;
            background: #FF4B4B;
            height: 60px;
            text-align: center;
            color: #fff;
            line-height: 60px;
            font-size: 18px;
            letter-spacing: 1px;
        }

        .call_please {
            width: 50%;
            background: #333333;
            height: 60px;
            text-align: center;
            line-height: 60px;
            font-size: 18px;
            letter-spacing: 1px;
        }

        .call {
            text-decoration: none !important;
            color: #fff !important;
        }

        .content-box {
            height: 55px;
        }

        .card_box {
            margin: 30px auto;
            font-size: 17px;
        }

        .card_input {
            height: 55px;
            border: .5px solid #D2D2D2;
            width: 90%;
            display: flex;
            justify-content: center;
            margin: 0 auto 25px auto;
            align-items: center;
        }

        .card_input>div {
            width: 20%;
            text-align: center;
            letter-spacing: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .card_input>input {
            height: 90%;
            width: 70%;
            border: 0;
            outline: none;
        }

        .touzi_confirm,
        .touzi_confirms,
        .touzi_confirmd {
            outline: none;
            height: 50px;
            border-radius: 999px;
            background: #FC1114;
            border: 0;
            color: #fff;
            margin-bottom: 30px;
            font-size: 22px;
            width: 90%;
            margin: 0 5% 20px 5%;
        }

        .touzi {
            width: 90%;
            margin: 30px auto;
        }

        .touzi>h1 {
            font-size: 17px;
        }

        .touzi_left {
            margin: 15px 0;
            font-size: 15px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .touzi_choose1,
        .touzi_choose2,
        .touzi_choose3,
        .touzi_choose4 {
            width: 20px;
            height: 20px;
            margin-right: 5px;
        }
    </style>
</head>

<body>
    <div class="top">
        <img class="head" src="image/head.png" alt="">
    </div>
    <div style="height: 88px;"></div>
    <img src="image/1.png" alt="">
    <div style="background-color: #fff;">
        <div class="card_box">
            <div class="card_input">
                <div>
                    <text>姓名:</text>
                </div>
                <input type="text" id="name" class="name" placeholder="请输入姓名">
            </div>
            <div class="card_input">
                <div>
                    <text>电话:</text>
                </div>
                <input type="text" id="phone" class="phone" placeholder="请输入电话">
            </div>
            <div class="card_input">
                <div>
                    <text>城市:</text>
                </div>
                <input type="text" id="area" class="area" value="陕西省-西安市">
            </div>
        </div>
        <div class="touzi">
            <h1>您的投资预算:</h1>
            <div class="touzi_box">
                <div class="touzi_left">
                    <div style="display: flex;width: 37%;justify-content: center;">
                        <input class="touzi_choose1" type="radio" id="r1" name="rd" value="1"><span>10万元以下</span>
                    </div>
                    <div style="display: flex;width: 40%;justify-content: end;">
                        <input class="touzi_choose2" type="radio" id="r2" name="rd" value="3"><span>15-20万元</span>
                    </div>
                </div>
                <div class="touzi_left">
                    <div style="display: flex;width: 35%;justify-content: center;">
                        <input class="touzi_choose3" type="radio" id="r3" name="rd" value="2"><span>10-15万元</span>
                    </div>
                    <div style="display: flex;width: 40%;justify-content: end;">
                        <input class="touzi_choose4" type="radio" id="r4" name="rd" value="4"><span>20万元以上</span>
                    </div>
                </div>
            </div>
        </div>
        <button class="touzi_confirm">立即申请 获取加盟资料</button>
    </div>
    <img src="image/2.jpg" alt="">
    <img src="image/3.jpg" alt="">
    <img src="image/4.jpg" alt="">
    <img src="image/5.jpg" alt="">
    <div style="background-color: #fff;">
        <div class="card_box">
            <div class="card_input">
                <div>
                    <text>姓名:</text>
                </div>
                <input type="text" id="names" class="name" placeholder="请输入姓名">
            </div>
            <div class="card_input">
                <div>
                    <text>电话:</text>
                </div>
                <input type="text" id="phones" class="phone" placeholder="请输入电话">
            </div>
            <div class="card_input">
                <div>
                    <text>城市:</text>
                </div>
                <input type="text" id="areas" class="area" value="陕西省-西安市">
            </div>
        </div>
        <div class="touzi">
            <h1>您的投资预算:</h1>
            <div class="touzi_box">
                <div class="touzi_left">
                    <div style="display: flex;width: 37%;justify-content: center;">
                        <input class="touzi_choose1" type="radio" id="r1" name="rd" value="1"><span>10万元以下</span>
                    </div>
                    <div style="display: flex;width: 40%;justify-content: end;">
                        <input class="touzi_choose2" type="radio" id="r2" name="rd" value="3"><span>15-20万元</span>
                    </div>
                </div>
                <div class="touzi_left">
                    <div style="display: flex;width: 35%;justify-content: center;">
                        <input class="touzi_choose3" type="radio" id="r3" name="rd" value="2"><span>10-15万元</span>
                    </div>
                    <div style="display: flex;width: 40%;justify-content: end;">
                        <input class="touzi_choose4" type="radio" id="r4" name="rd" value="4"><span>20万元以上</span>
                    </div>
                </div>
            </div>
        </div>
        <button class="touzi_confirms">立即申请 获取加盟资料</button>
    </div>
    <img src="image/6.jpg" alt="">
    <img src="image/7.jpg" alt="">
    <img src="image/8.jpg" alt="">
    <div style="background-color: #fff;">
        <div class="card_box">
            <div class="card_input">
                <div>
                    <text>姓名:</text>
                </div>
                <input type="text" id="named" class="name" placeholder="请输入姓名">
            </div>
            <div class="card_input">
                <div>
                    <text>电话:</text>
                </div>
                <input type="text" id="phoned" class="phone" placeholder="请输入电话">
            </div>
            <div class="card_input">
                <div>
                    <text>城市:</text>
                </div>
                <input type="text" id="aread" class="area" value="陕西省-西安市">
            </div>
        </div>
        <div class="touzi">
            <h1>您的投资预算:</h1>
            <div class="touzi_box">
                <div class="touzi_left">
                    <div style="display: flex;width: 37%;justify-content: center;">
                        <input class="touzi_choose1" type="radio" id="r1" name="rd" value="1"><span>10万元以下</span>
                    </div>
                    <div style="display: flex;width: 40%;justify-content: end;">
                        <input class="touzi_choose2" type="radio" id="r2" name="rd" value="3"><span>15-20万元</span>
                    </div>
                </div>
                <div class="touzi_left">
                    <div style="display: flex;width: 35%;justify-content: center;">
                        <input class="touzi_choose3" type="radio" id="r3" name="rd" value="2"><span>10-15万元</span>
                    </div>
                    <div style="display: flex;width: 40%;justify-content: end;">
                        <input class="touzi_choose4" type="radio" id="r4" name="rd" value="4"><span>20万元以上</span>
                    </div>
                </div>
            </div>
        </div>
        <button class="touzi_confirmd">立即申请 获取加盟资料</button>
    </div>
    <div class="content-box"></div>
    <div class="bottom">
        <div class="share_money">推荐赚钱</div>
        <div class="call_please">
            <a class="call" href="tel:13379293979">电话咨询</a>
        </div>
    </div>
</body>
<script src="js/json.js"></script>
<script src="js/jsonExchange.js"></script>
<script src="js/mPicker.min.js"></script>
<script>
    $(() => {
        let u = navigator.userAgent;
        // 判断ios
        let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
        // 判断android
        let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1

        //判断微信
        function isWeiXin() {
            var ua = window.navigator.userAgent.toLowerCase();
            if (ua.match(/MicroMessenger/i) == 'micromessenger') {
                return true; // 是微信端
            } else {
                return false;
            }
        }
        // 表情
        let emotion = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n])|(\s)/g
        // 用户id
        let user_id = getUrldata('Uid')
        // 推荐id
        let a_id = getUrldata('hd')
        let url_ = 'partner.html?Uid=' + user_id
        // 切割区域
        function reg(zone) {
            let zone_arr = zone.split('-')
            return zone_arr
        }

        // 跳转到分享页面
        $('.share_money').click(() => {
            // 判断是否为合伙人
            $.ajax({
                url: 'https://api.cd1a.cn/index.php/activity/Trans/ispartner',
                type: 'POST',
                data: {
                    userid_locked: user_id
                },
                dataType: 'json'
            }).then(res => {
                console.log(res)
                if (res.code == '1') {
                    // 是合伙人
                    window.location.href = 'share_money.html?user_id=' + user_id + '&id=' + a_id
                } else if (res.code == '2') {
                    // 不是合伙人
                    if (isWeiXin()) {
                        (() => {
                            window.alert = function (name) {
                                var iframe = document.createElement("IFRAME");
                                iframe.style.display = "none";
                                iframe.setAttribute("src", 'data:text/plain');
                                document.documentElement.appendChild(iframe);
                                window.frames[0].window.alert(name);
                                iframe.parentNode.removeChild(iframe);
                            }
                        })()
                        alert(res.msg)
                        window.location.replace(url_)
                        return
                    }
                    if (isiOS) {
                        window.webkit.messageHandlers.showAlert.postMessage(res.msg)
                        window.location.replace(url_)
                        return
                    }
                    if (isAndroid) {
                        window.TiantianCharge_Android.showAlert(res.msg)
                        window.location.replace(url_)
                        return
                    }
                } else {
                    // 其他
                    info_alert(res.msg)
                }
            })
        })

        $('.call').click(() => {
            if (isiOS) {
                window.webkit.messageHandlers.call.postMessage('13379293979')
            }
            if (isAndroid) {
                window.TiantianCharge_Android.call('13379293979')
            }
        })

        $('.area').mPicker({
            level: 2,
            dataJson: dataJson,
            Linkage: true,
            rows: 6,
            idDefault: true,
            splitStr: '-',
            header: '<div class="mPicker-header">省市选择</div>',
            confirm: function (json) {
                console.info(json)
                $('#area').val(json.name)
                $('#aread').val(json.name)
                $('#areas').val(json.name)
            },
            cancel: function (json) {
            }
        })

        // 统一弹框
        function info_alert(param) {
            if (isWeiXin()) {
                (() => {
                    window.alert = function (name) {
                        var iframe = document.createElement("IFRAME");
                        iframe.style.display = "none";
                        iframe.setAttribute("src", 'data:text/plain');
                        document.documentElement.appendChild(iframe);
                        window.frames[0].window.alert(name);
                        iframe.parentNode.removeChild(iframe);
                    }
                })()
                alert(param)
                return
            }
            if (isiOS) {
                window.webkit.messageHandlers.showAlert.postMessage(param)
                return
            }
            if (isAndroid) {
                window.TiantianCharge_Android.showAlert(param)
                return
            }
        }

        $('.touzi_confirm').click(function () {
            let name = $('#name').val()
            let phone = $('#phone').val()
            let area = $('#area').val()
            let area_arr = reg(area)
            let radio_type = $('input:radio:checked').val()
            if (name == '' || phone == '') {
                info_alert('请输入内容')
            } else if (radio_type == undefined || radio_type == '') {
                info_alert('请选择投资预算')
            } else if (/^1[3456789]\d{9}$/.test(phone) == false) {
                info_alert('电话有误,请重新输入')
            } else if (emotion.test(name) || emotion.test(phone)) {
                info_alert('电话有误,请重新输入')
            } else {
                $.ajax({
                    type: 'POST',
                    data: {
                        userid_locked: user_id,
                        name: name,
                        tel: phone,
                        province: area_arr[0],
                        city: area_arr[1],
                        type: radio_type,
                        a_id: a_id
                    },
                    url: 'https://api.cd1a.cn/index.php/activity/Trans/attract',
                    dataType: 'json',
                    async: true,
                    success: function (res) {
                        console.log(res)
                        if (res.code == '1') {
                            if (isWeiXin()) {
                                (() => {
                                    window.alert = function (name) {
                                        var iframe = document.createElement("IFRAME");
                                        iframe.style.display = "none";
                                        iframe.setAttribute("src", 'data:text/plain');
                                        document.documentElement.appendChild(iframe);
                                        window.frames[0].window.alert(name);
                                        iframe.parentNode.removeChild(iframe);
                                    }
                                })()
                                alert('录入成功')
                                location.reload()
                            }
                            if (isiOS) {
                                window.webkit.messageHandlers.showAlert.postMessage('录入成功')
                                location.reload()
                            }
                            if (isAndroid) {
                                window.TiantianCharge_Android.showAlert('录入成功')
                                location.reload()
                            }
                        } else {
                            info_alert(res.msg)
                        }
                    }
                })
            }
        })

        $('.touzi_confirms').click(function () {
            let name = $('#names').val()
            let phone = $('#phones').val()
            let area = $('#areas').val()
            let area_arr = reg(area)
            let radio_type = $('input:radio:checked').val()
            if (name == '' || phone == '') {
                info_alert('请输入内容')
            } else if (radio_type == undefined || radio_type == '') {
                info_alert('请选择投资预算')
            } else if (/^1[3456789]\d{9}$/.test(phone) == false) {
                info_alert('电话有误,请重新输入')
            } else if (emotion.test(name) || emotion.test(phone)) {
                info_alert('电话有误,请重新输入')
            } else {
                $.ajax({
                    type: 'POST',
                    data: {
                        userid_locked: user_id,
                        name: name,
                        tel: phone,
                        province: area_arr[0],
                        city: area_arr[1],
                        type: radio_type,
                        a_id: a_id
                    },
                    url: 'https://api.cd1a.cn/index.php/activity/Trans/attract',
                    dataType: 'json',
                    async: true,
                    success: function (res) {
                        console.log(res)
                        if (res.code == '1') {
                            if (isWeiXin()) {
                                (() => {
                                    window.alert = function (name) {
                                        var iframe = document.createElement("IFRAME");
                                        iframe.style.display = "none";
                                        iframe.setAttribute("src", 'data:text/plain');
                                        document.documentElement.appendChild(iframe);
                                        window.frames[0].window.alert(name);
                                        iframe.parentNode.removeChild(iframe);
                                    }
                                })()
                                alert('录入成功')
                                location.reload()
                            }
                            if (isiOS) {
                                window.webkit.messageHandlers.showAlert.postMessage('录入成功')
                                location.reload()
                            }
                            if (isAndroid) {
                                window.TiantianCharge_Android.showAlert('录入成功')
                                location.reload()
                            }
                        } else {
                            info_alert(res.msg)
                        }
                    }
                })
            }
        })

        $('.touzi_confirmd').click(function () {
            let name = $('#named').val()
            let phone = $('#phoned').val()
            let area = $('#aread').val()
            let area_arr = reg(area)
            let radio_type = $('input:radio:checked').val()
            if (name == '' || phone == '') {
                info_alert('请输入内容')
            } else if (radio_type == undefined || radio_type == '') {
                info_alert('请选择投资预算')
            } else if (/^1[3456789]\d{9}$/.test(phone) == false) {
                info_alert('电话有误,请重新输入')
            } else if (emotion.test(name) || emotion.test(phone)) {
                info_alert('电话有误,请重新输入')
            } else {
                $.ajax({
                    type: 'POST',
                    data: {
                        userid_locked: user_id,
                        name: name,
                        tel: phone,
                        province: area_arr[0],
                        city: area_arr[1],
                        type: radio_type,
                        a_id: a_id
                    },
                    url: 'https://api.cd1a.cn/index.php/activity/Trans/attract',
                    dataType: 'json',
                    async: true,
                    success: function (res) {
                        console.log(res)
                        if (res.code == '1') {
                            if (isWeiXin()) {
                                (() => {
                                    window.alert = function (name) {
                                        var iframe = document.createElement("IFRAME");
                                        iframe.style.display = "none";
                                        iframe.setAttribute("src", 'data:text/plain');
                                        document.documentElement.appendChild(iframe);
                                        window.frames[0].window.alert(name);
                                        iframe.parentNode.removeChild(iframe);
                                    }
                                })()
                                alert('录入成功')
                                location.reload()
                            }
                            if (isiOS) {
                                window.webkit.messageHandlers.showAlert.postMessage('录入成功')
                                location.reload()
                            }
                            if (isAndroid) {
                                window.TiantianCharge_Android.showAlert('录入成功')
                                location.reload()
                            }
                        } else {
                            info_alert(res.msg)
                        }
                    }
                })
            }
        })

        function getUrldata(name) {
            let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            let r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]);
            return null;
        }
    })
</script>

</html>